import { DateTime } from 'luxon'
import {BaseModel, beforeCreate, column} from '@ioc:Adonis/Lucid/Orm'
import uuid from 'uuid-v4'
export default class Log extends BaseModel {
  public static table = 'logs'
  @column({ isPrimary: true })
  public id: string
  @column()
  public methodName: string;
  @column()
  public username: string;
  @column()
  public description: string;
  @column.dateTime({ autoCreate: true })
  public createdAt: DateTime

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  public updatedAt: DateTime
  @beforeCreate()
  public static assignUuid(log: Log) {
     log.id = uuid()
  }
}
